<nav class="nav navbar-default">
    <div class="container-fluid">
        <div class="col-md-offset-1 col-md-10 col-sm-12">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed"
                        data-toggle="collapse" data-target="#navbar-weight" aria-expanded="false">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a  class="navbar-brand" href="#">Blog</a>
            </div>
            <div class="collapse navbar-collapse" id="navbar-weight">
                <ul class="nav navbar-nav">
                    <li id="home-page"><a href="{% url 'homepage' %}">首页</a></li>
                    {% for item in nav_item_list %}
                        <li id="{{ item.id }}"><a href="{{ item.url }}">{{ item.title }}</a></li>
                    {% endfor %}
                </ul>
                <ul class="nav navbar-nav navbar-right">
                    {% if user.is_authenticated %}
                       <li><a href="{% url 'dashboard' %}">后台</a></li>
                       <li><a href="{% url 'user-logout' %}">注销</a></li>
                    {% else %}
                        <li><a href="{% url 'user-login' %}">登录</a></li>
                    {% endif %}
                </ul>
            </div>
        </div>
    </div>
</nav>